{template '_header'}


<div class="page-heading">
    <span class="pull-right">
        <a class="btn btn-primary btn-sm" href="{php echo webUrl('merch/clearing/add');}"><i class="fa fa-plus"></i> 生成结算单</a>
	</span>
    <h2>商户结算</h2>
</div>

<form action="./index.php" method="get" class="form-horizontal table-search" role="form">
    <input type="hidden" name="c" value="site" />
    <input type="hidden" name="a" value="entry" />
    <input type="hidden" name="m" value="ewei_shopv2" />
    <input type="hidden" name="do" value="web" />
    <input type="hidden" name="r" value="merch.clearing.status0" />
    <div class="page-toolbar row m-b-sm m-t-sm">
        <div class="col-sm-5">
            <div class="btn-group btn-group-sm" style='float:left'>
                <button class="btn btn-default btn-sm"  type="button" data-toggle='refresh'><i class='fa fa-refresh'></i></button>
            </div>
            {php echo tpl_daterange('datetime', array('sm'=>true,'placeholder'=>'按结算时间查询'),true);}
        </div>
        <div class="col-sm-6 pull-right">
            <select name='status'  class='form-control  input-sm select-md'   style="width:120px;">
                <option value='' {if $_GPC['status']==''}selected{/if}>结算状态</option>
                <option value='0' {if $_GPC['status']=='0'}selected{/if}>未结算</option>
                <option value='1' {if $_GPC['status']=='1'}selected{/if}>结算中</option>
                <option value='2' {if $_GPC['status']=='2'}selected{/if}>已结算</option>
            </select>
            <div class="input-group">
                <input type="text" class="form-control input-sm" name="realname" value="{$_GPC['realname']}" placeholder="可搜索商户名称/姓名/手机号"/>
				 <span class="input-group-btn">
                     <button class="btn btn-sm btn-primary" type="submit"> 搜索</button>
                     <button type="submit" name="export" value="1" class="btn btn-success btn-sm">导出</button>
				</span>
            </div>

        </div>
    </div>
</form>


<table class="table table-hover table-responsive">
    <thead class="navbar-inner">
    <tr>
        <!--<th style="width:25px;"><input type='checkbox' /></th>-->
        <th style="width:200px;">结算编号</th>
        <th style="width:120px;">商户信息</th>
        <!--<th style="width:100px;">订单抵扣</th>-->
        <!--<th style="width:100px;">订单会员折扣</th>-->
        <!--<th style="width:100px;">订单促销</th>-->
        <th style="width:100px;">订单应收</th>
        <th style="width:100px;">订单实收</th>
        <th style="width:100px;">抽成后金额</th>
        {if $_W['routes']=='merch.clearing.status2'}
        <th style="width:80px;">最终打款</th>
        {/if}
        <th style="width:80px;">订单状态</th>
        <th style="width:100px;">操作</th>
    </tr>
    </thead>
    <tbody>
    {loop $list $row}
    <tr>
        <!--<td style="position: relative; "><input type='checkbox'   value="{$row['id']}"/></td>-->
        <td>{$row['clearno']}</td>
        <td>{$row['realname']}<br/>{$row['mobile']}</td>
        <!--<td><label class="label label-primary">积分: {php echo floatval($row['deductprice'])}</label>-->
            <!--<br/><label class="label label-danger">余额: {php echo floatval($row['deductcredit2'])}</label></td>-->
        <!--<td>{$row['discountprice']}</td>-->
        <!--<td>{$row['isdiscountprice']}</td>-->
        <td>{$row['realprice']}元</td>
        <td>{$row['price']}</td>
        <td>{$row['realpricerate']}</td>
        {if $_W['routes']=='merch.clearing.status2'}
        <td>{$row['finalprice']}</td>
        {/if}
        <td>
            {if $row['status'] == '0'}
            <label class="label label-default">待确认</label>
            {elseif $row['status'] == '1'}
            <label class="label label-warning">待结算</label>
            {elseif $row['status'] == '2'}
            <label class="label label-primary">已结算</label>
            {/if}


        </td>
        <td style="overflow:visible;">
                <a class='btn btn-default btn-sm' href="{php echo webUrl('merch/clearing/edit',array('id' => $row['id']))}">详情</a>
            {if $row['status'] != '2'}
                <a data-toggle='ajaxRemove' href="{php echo webUrl('merch/clearing/delete',array('id' => $row['id']));}" class="btn btn-danger btn-sm" data-confirm='确认要删除此结账单?'>删除</a>
            {/if}
        </td>
    </tr>
    {/loop}
    </tbody>
</table>
{$pager}
{template '_footer'}